//获取cookie对应name的值
function getCookie(name) {
    let obj = {}
    let arr = document.cookie.split("; ")
    arr.forEach(item => {
        obj[item.split("=")[0]] = item.split("=")[1]
    })
    return obj[name]
}

//设置对应name和对应值value，和对应时间time的cookie值
//这里的time值指的是天数
function setCookie(name, value, time) {
    if (time) {
        let date = new Date()
        date.setDate(date.getDate() + time)
        let d = date.toUTCString()
        document.cookie = `${name}=${value}; expires=${d}; path=/`
    } else {
        document.cookie = `${name}=${value}; path=/`

    }
}
//删除对应的name的cookie
function delCookie(name) {
    setCookie(name, 1, -1)
}

//